﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Cassandra.Pool;
using System.Data.Cassandra.Connection.Nodes;
using System.Data.Cassandra.Connection.Pool;

namespace System.Data.Cassandra.Connection
{
    public class CassandraConnectionConfig
    {
        public IEnumerable<String> Hosts
        {
            get;
            private set;
        }
        public Int32 Port
        {
            get;
            private set;
        }
        public String Keyspace
        {
            get;
            private set;
        }
        public TimeSpan Timeout
        {
            get;
            private set;
        }
        public Int32 MinPoolCountPerHost
        {
            get;
            private set;
        }
        public Int32 MaxPoolCountPerHost
        {
            get;
            private set;
        }

        internal ICassandraNodeEnumerator CreateNodeEnumerator(ConnectionPool pool)
        {
            return new RingNodeEnumerator(pool);
        }

        public CassandraConnectionConfig(IEnumerable<String> hosts, Int32 port, String keyspace, Double timeout, Int32 minPoolCountPerHost, Int32 maxPoolCountPerHost)
        {
            Hosts = hosts;
            Port = port;
            Keyspace = keyspace;
            Timeout = TimeSpan.FromMilliseconds(timeout);
            MinPoolCountPerHost = minPoolCountPerHost;
            MaxPoolCountPerHost = maxPoolCountPerHost;
        }
    }
}
